<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
	
	
	
	
	
	/**
	 * 
	 * Sessions_mdl
	 * 
	 * class to manage all session data for the user
	 */
	class Sessions_mdl extends CI_Model {
		
		
		
		
		
		/**
		 * 
		 * __construct
		 */
		public function __construct () {
			parent::__construct();
		}
		// end: __construct
		
		
		
		
		
		/**
		 * 
		 * set_session
		 * 
		 * method to set session whit the username
		 * 
		 * @param String $username
		 */
		public function set_session ($username = '') {
			
			switch ($username) {
				case 'root':
					$usertype = 'root';
					break;
				case 'statistics':
					$usertype = 'stats';
					break;
				case 'username':
				default:
					$usertype = 'user';
			}
			
			$session_data = array(
				'cisco_session_username' => 'username',
				'cisco_session_usertype' => $usertype,			// types: user|stats|root
			);
			$this->session->set_userdata($session_data);
		}
		// end: set_session
		
		
		
		
		
		/**
		 * 
		 * unset_session
		 * 
		 * method to unset all session data
		 */
		public function unset_session () {
			
			// session_data
			$session_data = array(
				'cisco_session_username' => '',
				'cisco_session_usertype' => '',			// types: user|stats|root
			);
			
			// unset session
			$this->session->unset_userdata($session_data);
			
			// destroying session
			$this->session->sess_destroy();
		}
		// end: unset_session
	}
	// end: Sessions_mdl	